package com.team.admin;

import com.team.common.generator.MybatisPlugsGeneratorUtil;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class GeneratorMain {

    public static void main(String[] args) {
//        String model = "sys";
//        String parentPackage = "com.team.admin";
//        String[] tables = new String[]{"sys_menu","sys_role","sys_role_menu","sys_role_user","sys_user"};
//
//        MybatisPlugsGeneratorUtil.start(model,parentPackage,tables);

        BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
        System.out.println(encoder.encode("admin"));

        ScheduledExecutorService executorService =
                Executors.newSingleThreadScheduledExecutor();
        while (true){
            for(int i =0;i < 2;i ++){
                executorService.schedule(new BeatTask(),1, TimeUnit.MILLISECONDS);
            }
            try {
                TimeUnit.MILLISECONDS.sleep(10000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }


    }

}

class BeatTask implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getId());
    }
}
